using UnityEditor;
using UnityEngine;

[CustomPropertyDrawer(typeof(SetRangeAttribute))]
public class SetRangeAttribute_Drawer : PropertyDrawer
{
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        SetRangeAttribute myRange = attribute as SetRangeAttribute;
        label.text = myRange.headerName;
        if (property.propertyType == SerializedPropertyType.Integer)
        {
            EditorGUI.IntSlider(position, property, (int)myRange.min, (int)myRange.max, label);
        }
        else if (property.propertyType == SerializedPropertyType.Float)
        {
            EditorGUI.Slider(position, property, myRange.min, myRange.max, label);
        }
    }
}